package com.zhima.feignclient;

import com.zhima.dto.AiGuide;
import com.zhima.dto.FeignJudgeRecordDTO;
import com.zhima.dto.FeignJudgeResult;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

@FeignClient("oj-judge-service")
@RequestMapping("/oj-judge/judge-record/feign")
public interface JudgeRecordFeignClient {
    /**
     * 更新{judgeRecordId}的测评状态
     *
     * @param judgeRecordId
     * @param judgeRecordState
     */
    @PostMapping("/{judgeRecordId}/{judgeRecordState}")
    boolean updateJudgeRecordState(@PathVariable("judgeRecordId") Long judgeRecordId, @PathVariable("judgeRecordState") String judgeRecordState);

    /**
     * 根据{judgeRecordId}获取指定评测记录
     *
     * @param judgeRecordId
     * @return
     */
    @GetMapping("/{judgeRecordId}")
    FeignJudgeRecordDTO queryJudgeRecordById(@PathVariable("judgeRecordId") Long judgeRecordId);

    /**
     * 通知测评结果
     *
     * @param judgeRecordId
     * @param feignJudgeResult
     * @return
     */
    @PostMapping("/judge0/notify/{judgeRecordId}")
    boolean updateJudge0Result(@PathVariable("judgeRecordId") Long judgeRecordId, @RequestBody FeignJudgeResult feignJudgeResult);

    /**
     * 删除所有与questionId关联的测评记录
     *
     * @param questionId
     * @return
     */
    @DeleteMapping("/{questionId}")
    boolean deleteQuestionJudgeRecord(@PathVariable("questionId") Long questionId);

    /**
     * 更新AI指导意见
     *
     * @param aiGuide
     * @return
     */
    @PostMapping("/ai")
    boolean aiGuide(@RequestBody AiGuide aiGuide);
}
